home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 009 / atov_ex.arc / READ.ME < prev    next >
Encoding:
Text File  |  1987-03-31  |  2.2 KB  |  46 lines

  1.         C specifications explicitly say that atoi() and similar functions
  2. do not check for overflow.  I found that I wanted to do so, so I wrote the
  3. four functions atoi_ex, atol_ex, atou_ex and atoul_ex, where the "ex"
  4. stands for "extended".  They all check for overflow, and they all return
  5. a pointer the the character which terminates the number.  In addition,
  6. they all strip leading white space characters from the number.  They all
  7. return a result code which tells what happened.
  8.  
  9.         Because C doesn't check for overflow, I decided to do the main
  10. work in assembly language.  The functions _natoi and _natol convert a
  11. string of digits to an unsigned int or an unsigned long, check for
  12. overflow and find the terminating character.  They are not intended for
  13. use by themselves.  I would like to hide them, but I don't know how to
  14. do it in this mixed language situation.
  15.  
  16.         ATOV_EX.C contains full instructions for using the functions.
  17.  
  18.         _NATOIL.ASM, which contains the source for the assembly programs,
  19. includes DOS.MAC, which is a Lattice C file which contains MACROS which
  20. generate most of the conventional information, such as GROUP and SEGMENT
  21. names, which MASM needs and which also contains some MACROS to interface
  22. with Lattice C.  As a result, it probably won't work as is with any other
  23. compiler, but the changes should be routine.  I am using Version 3.10.  I
  24. don't have earlier versions available, so I can not be sure that all the
  25. MACROS in _NATOIL.ASM were defined.
  26.  
  27.         The files in ATOV_EX.ARC are:
  28. ATOV_EX.C       Sources for atoi_ex, atol_ex, atou_ex and atoul_ex.
  29. ATOV_EX.H       Function prototypes.
  30. ATOV_EXS.LIB    Library which contains Lattice C small model
  31.                 ATOI_EX.OBJ, ATOL_EX.OBJ, ATOU_EX.OBJ, ATOUL_EX.OBJ,
  32.                 _NATOI.OBJ and _NATOL.OBJ.
  33. READ.ME         This file.
  34. TATOV_EX.C      Source for tests.
  35. _NATOIL.ASM     Sources for _natoi and _natol.
  36.  
  37.         I hope these functions are useful.  They are available for any
  38. non-commercial use.  Of course, I am not responsible for any bad things
  39. they do to you.
  40.  
  41. Lew Paper
  42. 8/31/86
  43.  
  44. (Lew Paper and other fine programmers frequent
  45. Terrapin Station dBBS (networked) 2400/1200  24 hrs a day
  46. 612/623-0152    Minneapolis, MN)